package com.ssm.blog.controller;

import com.github.pagehelper.PageInfo;
import com.ssm.blog.service.PhotoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/photo")
public class PhotoController {

    @Autowired
    private PhotoService photoService;

    @RequestMapping("/list.html")//使用ajax进行分页查询
    @ResponseBody
    public PageInfo<String> getPhotoList(@RequestParam(defaultValue = "1") Integer pageNum) {
        PageInfo<String> photoPager = photoService.getBlogPhotoList(pageNum);
        return photoPager;
    }

    @RequestMapping("/show.html")
    public String show() {
        return "photo_list";
    }


}
